__init__(self master=None) vs __init__(self parent controller)

by: king_turbo, 7 years ago


I'm going through the OOP crash course. After entering the code for the basic window from the first part of the tutorial, I replaced parent and controller with master=None. As expected, it gave an error stating that __init__ could only take 2 variables when 3 were given. I remembered from a previous example we set master=None. I'm a bit confused when to use (self, parent, controller) versus just (self, master=None). I'm a noob.



You must be logged in to post. Please login or register an account.



I am not 100% positive which code you are referring to, but the __init__ method is one that just simply always runs in a class when it is created. All __init__ methods are not the same, it just depends on their parameters.

-Harrison 7 years ago

You must be logged in to post. Please login or register an account.